<template>
  <div class="tjfx">
    <el-select v-model="Hname" placeholder="请选择" @change="gb()">
      <el-option
        :value="item.healthMgrName"
        v-for="item in heal"
        :key="item.healthMgrId"
        >{{ item.healthMgrName }}</el-option
      >
    </el-select>
    <div id="main" style="width: 1000px; height: 500px; background-color: aquamarine;"></div>
    
    <el-table
      
      align="center"
      v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      :data="Health"
    >
      <el-table-column label="健康管理师" prop="name" width="120">
      </el-table-column>
      <el-table-column label="干预方案总量" prop="gyfa" width="120">
      </el-table-column>
      <el-table-column label="干预回访总量" prop="gyhf" width="120">
      </el-table-column>
      <el-table-column label="干预结束总量" prop="gyjs" width="120">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import Vue from "vue";
import * as echarts from "echarts";
import axios from "axios";
import VueAxios from "vue-axios";
Vue.use(VueAxios, axios);
export default Vue.extend({
  data() {
    return {
      loading:true,
      heal: [],
      Hname:"",
      Health:[]
    };
  },
  methods: {
    gb() {
      var myChart = echarts.init(document.getElementById("main"));
      axios.get("/api/tfollow/gettjfx?name="+this.Hname).then(data=>{
        var  ss=[];
        var  bb=[];
       data.data.forEach(element => {
          ss.push(element.kk)
          bb.push(element.dd)
       });
      myChart.setOption({
        xAxis: {
          type: "category",
          data: ss,
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: bb,
            type: "line",
          },
        ],
      });
       })
    },

    load() {
      axios.get("/api/tfollow/gethealth").then((data) => {
        this.heal = data.data;
      });
    },

    load1(){
      axios.post("/api/tfollow/ganyu").then(ele=>{
        //console.log(data.data);
        this.Health=ele.data;

         //加载样式
        setTimeout(() => {
          this.loading=false;
        }, 1000);
      })
    }
  },
  mounted() {
    this.gb();
  },
  created() {
    this.load();
    this.load1();
  },
});
</script>

<style scoped>
</style>